using System;
using System.Collections.Generic;
using UnityEngine;

[Serializable]
public class TutorialBase : MonoBehaviour
{
	public List<TutorialButtonId> arrActiveButton = new List<TutorialButtonId>();

	public bool isStarted;

	public bool needActiveButtonOnStart = true;

	public virtual void OnStart()
	{
		base.gameObject.SetActive(true);
		isStarted = true;
	}

	public virtual void OnStop()
	{
		isStarted = false;
		if (base.gameObject != null)
		{
			UnityEngine.Object.Destroy(base.gameObject);
		}
	}

	public virtual void OnUpdate()
	{
	}

	public virtual void OnComplete()
	{
		if (TutorialManager.instance != null)
		{
			TutorialManager.instance.CompleteCurStepTutorial();
		}
	}

	public void ShowText(string showText, float timeShow = 0f, bool isTony = false)
	{
		HideText();
		showText = showText.Replace("[/n]", "\n");
		if (isTony)
		{
			TutorialManager.instance.lbTextTutorialTony.text = showText;
			TutorialManager.instance.lbTextTutorialTony.gameObject.SetActive(true);
		}
		else
		{
			TutorialManager.instance.lbTextTutorial.text = showText;
			TutorialManager.instance.lbTextTutorial.gameObject.SetActive(true);
		}
		CancelInvoke("HideText");
		if (timeShow > 0f)
		{
			Invoke("HideText", timeShow);
		}
	}

	public void HideText()
	{
		TutorialManager.instance.lbTextTutorial.text = string.Empty;
		TutorialManager.instance.lbTextTutorialTony.text = string.Empty;
		TutorialManager.instance.lbTextTutorial.gameObject.SetActive(false);
		TutorialManager.instance.lbTextTutorialTony.gameObject.SetActive(false);
	}
}
